<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">

<!--库存明细信息模态框-->
<div class="modal fade" id="modal-select">

    <div class="modal-dialog" style="width: 1350px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">原料库在库明细信息</h4>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="box">
                            <div class="box-header">
                                <form id="queryForm">
                                    <div class="row">
                                        <div class="form-inline">
                                            <div class="form-group">
                                                <label>项目编号</label>
                                                <input type="text" id="ityProCode" name="ityProCode"
                                                       class="form-control"
                                                       placeholder="请输入项目编号">
                                            </div>
                                            <div class="form-group">
                                                <label>项目名称</label>
                                                <input type="text" id="ityProName" name="ityProName"
                                                       class="form-control"
                                                       placeholder="请输入项目名称">
                                            </div>
                                            <!--2023.3.23 原料负责人  去掉查询条件供应商 合同编号 跟踪号-->
                                            <!--<div class="form-group">-->
                                                <!--<label>供应商</label>-->
                                                <!--<input type="text" id="supplier" name="supplier"-->
                                                       <!--class="form-control"-->
                                                       <!--placeholder="请输入供应商">-->
                                            <!--</div>-->
                                            <!--<div class="form-group">-->
                                                <!--<label>合同编号</label>-->
                                                <!--<input type="text" id="contractNo" name="contractNo"-->
                                                       <!--class="form-control"-->
                                                       <!--placeholder="请输入合同编号">-->
                                            <!--</div>-->
                                            <!--<div class="form-group">-->
                                                <!--<label>跟踪号</label>-->
                                                <!--<input type="text" id="ityTrackCode" name="ityTrackCode"-->
                                                       <!--class="form-control"-->
                                                       <!--placeholder="请输入跟踪号">-->
                                            <!--</div>-->
                                            <div class="form-group">
                                                <label>库位</label>
                                                <!--<select id="odrWhiId" class="form-control" name="odrWhiId">-->
                                                    <select id="whiIdList"
                                                            class="form-control selectpicker"
                                                            data-live-search="true" multiple
                                                            onchange="changewhiIdListStr(this)">
                                                    <!--<option value="">全部</option>-->
                                                    <option th:each="type:${warehouse}" th:value="${type.whiId}"
                                                            th:text="${type.whiName}"
                                                            th:selected="${type.whiName eq '原料库'}"></option>
                                                        <input name="whiIdListStr" type="hidden" style="display: none" />
                                                </select>
                                            </div>
                                            <div class="form-group">
                                                <label>
                                                    原料分类
                                                </label>
                                                <select id="materialKind" name="materialKind"
                                                        class="form-control">
                                                    <option value="型材">型材</option>
                                                    <option value="板材">板材</option>
                                                    <option value="" selected="selected">全部</option>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                                <label>原料类型</label>
                                                <select id="matTypeIdList" class="form-control selectpicker"
                                                        data-live-search="true" multiple>
                                                    <option th:each="type:${matType}" th:value="${type.mdId}"
                                                            th:text="${type.mdName}"></option>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                                <label>原料材质</label>
                                                <select id="matQualityIdList"
                                                        class="form-control selectpicker"
                                                        data-live-search="true" multiple>
                                                    <option th:each="type:${matQuality}" th:value="${type.mdId}"
                                                            th:text="${type.mdName}"></option>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                                <label>原料规格</label>
                                                <select id="matSpecIdList"
                                                        class="form-control selectpicker"
                                                        data-live-search="true" multiple>
                                                    <option th:each="type:${matSpec}" th:value="${type.mdId}"
                                                            th:text="${type.mdName}"></option>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                                <label>宽度</label>
                                                <input type="number" step="0.1" id="matWidth"
                                                       name="matWidth" class="form-control"
                                                       placeholder="请输入原料宽度">
                                            </div>
                                            <div class="form-group">
                                                <label>长度</label>
                                                <input type="number" step="0.1" id="matLength"
                                                       name="matLength" class="form-control"
                                                       placeholder="请输入原料长度">
                                            </div>
                                            <div class="form-group">
                                                <label>米重/厚度</label>
                                                <input type="number" step="0.1" id="matHeight"
                                                       name="matHeight" class="form-control"
                                                       placeholder="请输入原料米重/厚度">
                                            </div>
                                            <!--<div class="form-group">-->
                                                <!--<label>单价</label>-->
                                                <!--<input type="number" step="0.1" id="ityPriceStr"-->
                                                       <!--name="ityPriceStr" class="form-control"-->
                                                       <!--placeholder="请输入单价">-->
                                            <!--</div>-->
                                            <div class="form-group">
                                                <label>
                                                    在库类型
                                                </label>
                                                <select id="ityInType" name="ityInType" class="form-control">
                                                    <option value="1">库存在库</option>
                                                    <option value="2">项目在库</option>
                                                    <option value="" selected="selected">全部</option>
                                                </select>
                                            </div>
                                            <div class="form-group">
                                                <label>
                                                    是否串料
                                                </label>
                                                <select id="ityCeoSourceFlag" name="ityCeoSourceFlag" class="form-control">
                                                    <option value="1">是</option>
                                                    <option value="0">否</option>
                                                    <option value="" selected="selected">全部</option>
                                                </select>
                                            </div>
                                            <button type="button" class="btn btn-success" id="btn-search">搜索</button>
                                            <button type="button" class="btn btn-info" id="btn-clear">清空筛选条件</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="box-body">
                                <table id="bootstrap-table">
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer" style="padding-top: 5px;">
                <button type="button" class="btn btn-info" id="btn-selectMaterial-commit">确定</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>

</div>

<section class="content-header">
    <h1>
        出库单
    </h1>
</section>
<section class="content">

    <div id="printArea" style=" display: none;">
        <div style="padding-bottom: 10px;text-align: center;vertical-align: middle;">
            <div style="font-size: 20px;vertical-align: middle;display: inline-block;font-weight: bold;">辽宁忠旺机械设备制造有限公司出库单</div>
        </div>
        <table style="font-size:12px;width: 100%;line-height: 20px;">
            <tr>
                <td width="25%">使用部门：<label id="odrTakeWorkshopPrint" style="font-weight: normal"></label></td>
                <td width="20%">领料人：<label id="odrTakePersonPrint" style="font-weight: normal"></label></td>
                <td width="25%">出库日期：<label id="odrDatePrint" style="font-weight: normal"></label>
                </td>
                <td width="30%">单据编号：<label id="odrCodePrint" style="font-weight: normal"></label></td>
            </tr>
            <tr>
                <td colspan="3">摘要：<label id="odrRemarkPrint" style="font-weight: normal"></label></td>
                <td>制单人：<label id="odrMakePersonPrint" style="font-weight: normal"></label></td>
            </tr>
        </table>
        <div id="table-box">
        </div>
    </div>

    <form id="outBillForm" role="form"
          enctype="multipart/form-data">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-body">
                        <div class="row">
                            <input type="hidden" id="odrType" name="odrType" value="4">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label>领料人</label>
                                    <input id="odrTakePerson" type="text" class="form-control" name="odrTakePerson"
                                           placeholder=""
                                           autocomplete="off"/>
                                </div>
                                <div class="form-group">
                                    <label>出库日期</label>
                                    <input type="text" class="form-control datepicker" th:value="${odrDate}"
                                           id="odrDate" name="odrDate" readonly="readonly"/>
                                </div>
                                <div class="form-group">
                                    <label>摘要</label>
                                    <input id="odrRemark" type="text" class="form-control" name="odrRemark"
                                           placeholder=""
                                           autocomplete="off"/>
                                </div>
                                <div class="form-group">
                                    <label>使用部门</label>
                                    <select id="odrTakeWorkshop" class="form-control select2" name="odrTakeWorkshop">
                                        <option value="">请选择</option>
                                        <option th:each="type:${dept}" th:value="${type.depName}"
                                                th:text="${type.depName}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <button shiro:hasPermission="matwar:matoutwar:edit" type="button" class="btn btn-info pull-left"
                                            id="btn-select">
                                        选择
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div id="hot"></div>
                        </div>
                    </div>
                    <div class="box-footer">
                        <div class="row">
                            <div class="col-md-2">
                                <label>制单人：</label><label th:text="${odrMakePerson}"></label>
                            </div>
                            <div class="col-md-6">
                                <label></label>
                            </div>
                            <div class="col-md-4">
                                <div class="col-md-2 col-md-offset-6">
                                </div>
                                <div class="col-md-2">
                                    <button shiro:hasPermission="matwar:matoutwar:edit" type="button" id="btn-save"
                                            class="btn btn-info file-contract btn-file">保存
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</section>
<div th:include="include :: footer"></div>
<script th:src="@{/js/jquery.PrintArea.js}"></script>
<script th:inline="javascript">

    /**模态框加载*/
    var table;
    /**可编辑表单数据源*/
    var data = [];
    /**
     * 库位改变事件
     * */
    function changewhiIdListStr(obj){
       $("#queryForm [name='whiIdListStr']").val($(obj).val().join(','));
    }
    /**获取物料在库信息（模态框数据源）*/
    function openInventoryList() {
        table = js.table.init({
            url: ctx + "matInvManage/complex/list",
            pageSize: 100,
            showExport: false,
            queryData: {
                ityProCode: $("#ityProCode").val(),
                ityTrackCode: $("#ityTrackCode").val(),
                matTypeIdList: $("#matTypeIdList").val(),
                matQualityIdList: $("#matQualityIdList").val(),
                matSpecIdList: $("#matSpecIdList").val(),
                matWidth: $("#matWidth").val(),
                matLength: $("#matLength").val(),
                matHeight: $("#matHeight").val(),
                ityPrice: $("#ityPrice").val(),
                materialKind: $("#materialKind").val(),
                ityInType: $("#ityInType").val(),
                whiIdListStr:$("#queryForm [name='whiIdListStr']").val()
            },
            columns: [
                {
                    title: '序号', field: 'id', width: '40',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                {title: '物料描述', field: 'matNameDesc'},
                {title: '在库数量', field: 'ityNum'},
                {title: '可用数量', field: 'ityAvaNum'},
                {title: '在库重量', field: 'ityWeight'},
                {title: '可用重量', field: 'ityAvaWeight'},
                {title: '跟踪号', field: 'ityTrackCode'},
                {title: '项目编号', field: 'ityProCode'},
                {title: '项目名称', field: 'ityProName'},
                // {title: '供应商', field: 'supplier'},
                // {title: '合同编号', field: 'contractNo'},
                {title: '库位', field: 'whiName'},
                {title: '区位', field: 'ityPosition'},
                {
                    title: '在库类型', field: 'ityInType',
                    formatter: function (value, row, index) {
                        if (value === 1) {
                            return '库存在库';
                        } else if (value === 2) {
                            return '项目在库';
                        }
                    }
                },
                {title: '特殊说明', field: 'itySpec'},
                {
                    field: "checked",
                    title: '全选',
                    checkbox: true,
                    formatter: function (value, row, index) {
                        if ((row.ityDataStatus === 2)) {
                            return {
                                disabled: true,
                            }
                        } else {
                            return {
                                disabled: false,
                            }
                        }
                    }
                }
            ],
            rowStyle: function (row, index) {
                if (row.itySpec != null && row.itySpec.indexOf("不合格") >= 0) {
                    return {css: {"color": "red"}}
                } else {
                    return {css: {"color": "black"}}
                }
            }
        });
    }
    /**打印方法*/
    function printOrder(odrId) {

        js.get({
            url: ctx + "material/order/orderMaster",
            data: {odrId: odrId},
            success: function (result) {

                $("#odrDatePrint").text("");
                $("#odrTakePersonPrint").text("");
                $("#odrTakeWorkshopPrint").text("");
                $("#odrCodePrint").text("");
                $("#odrMakePersonPrint").text("");
                $("#odrRemarkPrint").text("");

                if (result.data["odr_id"] != null) {
                    alert("单据打印失败，请在单据管理中打印此单据！");
                    return;
                }

                $("#odrDatePrint").text(new Date(result.data["odrDate"]).format("yyyy-MM-dd"));
                $("#odrTakePersonPrint").text(result.data["odrTakePerson"]);
                $("#odrTakeWorkshopPrint").text(result.data["odrTakeWorkshop"]);
                $("#odrCodePrint").text(result.data["odrCode"]);
                $("#odrMakePersonPrint").text(result.data["odrMakePerson"]);
                $("#odrRemarkPrint").text(result.data["odrRemark"].indexOf("领料出库") != -1 ? "" : result.data["odrRemark"]);

                // 绑定打印明细数据
                printOrderDetail(odrId);
            }
        });
    }

    /**绑定打印明细数据*/
    function printOrderDetail(odrId) {

        $("#printArea").show();

        js.get({
            url: ctx + "material/order/orderDetail",
            data: {odrId: odrId},
            success: function (result) {
                var printList = result.data;

                // 添加dataTable表头
                $("#table-box").empty();
                $("#table-box").append('<table id="outBillTable"\n' +
                    '               style="font-size: 12px;text-align: center;border-right:1px solid;border-bottom:1px solid; border-collapse: collapse;"\n' +
                    '               width="100%"\n' +
                    '               cellspacing="0" cellpadding="1">\n' +
                    '        </table>');
                $("#outBillTable").append('<THEAD style="display:table-header-group;">\n' +
                    '                         <TR><td style="border-left: 1px solid;border-top: 1px solid;">序号</td>' +
                    '<td style="border-left: 1px solid;border-top: 1px solid;">原料描述(类型_材质_规格 宽*长*米重/厚度)</td>' +
                    '<td style="border-left: 1px solid;border-top: 1px solid;">数量</td>' +
                    '<td style="border-left: 1px solid;border-top: 1px solid;">领料长度(米)</td>' +
                    '<td style="border-left: 1px solid;border-top: 1px solid;">重量</td>' +
                    // '<td style="border-left: 1px solid;border-top: 1px solid;">跟踪号</td>' +
                    '<td style="border-left: 1px solid;border-top: 1px solid;">项目名称</td>' +
                    // '<td style="border-left: 1px solid;border-top: 1px solid;">供应商</td>' +
                    // '<td style="border-left: 1px solid;border-top: 1px solid;">合同编号</td>' +
                    '<td style="border-left: 1px solid;border-top: 1px solid;width: 8%">库位</td>' +
                    '<td style="border-left: 1px solid;border-top: 1px solid;width: 8%">备注</td></TR>\n ' +
                    '                         </THEAD> ');
                $("#outBillTable").append('<tbody id="myTb"> </tbody>');
                // 循环绑定dataTable行数据
                var rowIndex;
                var matNameDesc;
                var odaNum;
                var pkMatLength;
                var odaWeight;
                var odaTrackCode;
                var odaProName;
                var supplier;
                var contractNo;

                // var odaInTypeName;
                var odaWhiIdName;
                var odaSpec;

                var newRow;

                for (i = 0; i < printList.length; i++) {
                    rowIndex = printList[i]["rowIndex"];
                    matNameDesc = printList[i]["matNameDesc"];
                    odaNum = printList[i]["odaNum"];
                    pkMatLength = printList[i]["pkMatLength"];
                    odaWeight = printList[i]["odaWeight"];
                    odaTrackCode = printList[i]["odaTrackCode"];
                    odaProName = printList[i]["odaProNamePrint"];
                    // odaInTypeName = printList[i]["odaInTypeName"];
                    odaWhiIdName = printList[i]["odaWhiIdName"];
                    odaSpec = printList[i]["odaSpec"] == null ? '' : printList[i]["odaSpec"];
                    supplier = printList[i]["supplier"] == null ? '' : printList[i]["supplier"];
                    contractNo = printList[i]["contractNo"] == null ? '' : printList[i]["contractNo"];

                    newRow = "<tr><td style='border-left:1px solid;border-top:1px solid'>" + rowIndex + "</td>" +
                        "<td style='border-left:1px solid;border-top:1px solid'>" + matNameDesc + "</td>" +
                        "<td style='border-left:1px solid;border-top:1px solid'>" + odaNum + "</td>" +
                        "<td style='border-left:1px solid;border-top:1px solid'>" + pkMatLength + "</td>" +
                        "<td style='border-left:1px solid;border-top:1px solid'>" + odaWeight + "</td>" +
                        // "<td style='border-left:1px solid;border-top:1px solid'>" + odaTrackCode + "</td> \n" +
                        "<td style='border-left:1px solid;border-top:1px solid'>" + odaProName + "</td>" +
                        // "<td style='border-left:1px solid;border-top:1px solid'>" + supplier + "</td>" +
                        // "<td style='border-left:1px solid;border-top:1px solid'>" + contractNo + "</td>" +
                        "<td style='border-left:1px solid;border-top:1px solid'>" + odaWhiIdName + "</td>" +
                        "<td style='border-left:1px solid;border-top:1px solid'>" + odaSpec + "</td></tr>";
                    $("#myTb").append(newRow);
                }

                $("#printArea").printArea();
                $("#printArea").hide();
            }
        });
    }

    $(function () {

        var process = function (src) {

            if ($("#odrTakeWorkshop").val() == "") {
                js.modal.warning("请选择使用部门！");
                $("#odrTakeWorkshop").focus();
                return;
            }

            if ($.isEmptyObject(src.insertData)) {
                js.modal.warning("出库明细不允许为空！");
                return;
            }

            js.post({
                url: ctx + "material/order/outCreate",
                data: JSON.stringify(src),
                contentType: "application/json",
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success("单据保存成功！");

                        // 手动清空画面
                        data = [];
                        js.hot.loadData(data.slice(0));
                        $("#odrTakePerson").val("");
                        $("#odrRemark").val("");
                        $("#odrTakeWorkshop").val('').trigger("change");

                        // 调用打印方法
                        printOrder(result.msg);
                    } else {
                        js.modal.warning(result.msg);
                    }
                    js.modal.closeLoading();
                }
            })

        }

        /**删除指定行*/
        var removeProcess = function (index, amount) {
            data.splice(index, amount);
        };

        /**表单加载*/
        js.hot.init({
            element: document.getElementById('hot'),
            data: {},
            formData: ["odrType", "odrTakePerson", "odrRemark", "odrDate", "odrTakeWorkshop"],
            colHeaders: ['ID', '在库明细主键', '类型', '材质', '规格', '宽度', '长度', '米重/厚度', '数量','领料长度(米)', '重量', '跟踪号', '项目编号', '项目名称','供应商','合同编号','库位','区位', '在库类型', '回货时间', '备注', '计算公式'],
            fieldName: ['odaId', 'ityId', 'matType', 'matQuality', 'matSpec', 'matWidth', 'matLength', 'matHeight', 'odaNum','pkMatLength', 'odaWeight', 'odaTrackCode', 'odaProCode', 'odaProName','supplier','contractNo','whiName','odaPosition', 'odaInTypeName', 'odaBackDate', 'odaSpec', 'matFormulaType'],
            height: 700,
            correctFormat: true,
            minSpareRows: 100,
            hiddenColumns: {
                columns: [0, 1, 21],
                indicators: true
            },
            removeCallBack: removeProcess,
            callBack: process,
            saveButtonId: $("#btn-save"),
            customChange: function (row, changeName, data) {
                if (changeName === 'ityNum') {
                    var ityWeight = returnMaterialWeight(data[4], data[6], data[5], data[7], data[8], data[21]);
                    js.hot._hot.setDataAtRowProp(row, 'ityWeight', ityWeight + '');
                    var pkMatLength = returnMaterialLength(data[6], data[8], data[21]);
                    js.hot._hot.setDataAtRowProp(row, 'pkMatLength', pkMatLength + '');
                }
            },
            columns: [
                {
                    data: null
                },
                {
                    data: 'ityId',
                    type: 'text',
                    readOnly: true
                },
                {
                    data: 'matTypeName',
                    type: 'text',
                    readOnly: true
                },
                {
                    data: 'matQualityName',
                    type: 'text',
                    readOnly: true
                },
                {
                    data: 'matSpecName',
                    type: 'text',
                    readOnly: true
                },
                {
                    data: 'matWidth',
                    type: 'numeric',
                    readOnly: true
                },
                {
                    data: 'matLength',
                    type: 'numeric',
                    readOnly: true
                },
                {
                    data: 'matHeight',
                    type: 'numeric',
                    readOnly: true
                },
                {
                    data: 'ityNum',
                    type: 'numeric'
                },
                {
                    data:'pkMatLength',
                    type:'numeric',
                    readOnly: true
                },
                {
                    data: 'ityWeight',
                    type: 'numeric'
                },
                {
                    data: 'ityTrackCode',
                    type: 'text',
                    readOnly: true
                },
                {
                    data: 'ityProCode',
                    type: 'text',
                    // readOnly: true
                },
                {
                    data: 'ityProName',
                    type: 'text',
                    // readOnly: true
                },
                {
                    data: 'supplier',
                    type: 'text'
                },
                {
                    data: 'contractNo',
                    type: 'text'
                },
                {
                    data: 'whiName',
                    type: 'text',
                    readOnly: true
                },
                {
                    data: 'ityPosition',
                    type: 'text',
                    readOnly: true
                },
                {
                    data: 'ityInTypeName',
                    type: 'dropdown',
                    source: ['库存在库', '项目在库'],
                    readOnly: true
                },
                {
                    data: 'ityBackDate',
                    type: 'text',
                    readOnly: true
                },
                {
                    data: 'itySpec',
                    type: 'text'
                },
                {
                    data: 'matFormulaType',
                    type: 'text',
                    readOnly: true
                }
            ]
        })

        /**打开模态框*/
        $("#btn-select").on('click', function () {
            openInventoryList();
            js.modal.open("modal-select")
        });

        js.modal.hideEvent("modal-select", function () {
            js.table.destroy(table);
            // js.reset("queryForm");
        });

        /**选择库存模态框确定按钮点击事件*/
        $("#btn-selectMaterial-commit").click(function () {
            var rows = js.table.selectRows("bootstrap-table");
            // 如果没有选择库存，显示提示信息
            if (rows.length == 0) {
                js.modal.warning("请至少选择一个原料");
                return false;
            } else {
                // 将选中的每一行数据保存到一个数组中
                // 获取整个表格数据
                for (var i = 0; i < rows.length; i++) {
                    data.push(rows[i]);
                }
                var a = data.slice(0);
                js.hot.loadData(a);
                js.modal.hide("modal-select");
            }
        });

        /**分类下拉选值改变事件*/
        $("#materialKind").change(function () {

            js.get({
                url: ctx + "basic/materials/materialDictionary",
                data: {kindName: $('#materialKind option:selected').val()},
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        $("#matTypeIdList").empty().append('<option value="">请选择</option>');
                        $.each(result.data.materialTypeList, function (i, v) {
                            $("#matTypeIdList").append('<option value="' + v.mdId + '">' + v.mdName + '</option>');
                        });
                        //必不可少的刷新
                        $("#matTypeIdList").selectpicker('refresh');

                        $("#matQualityIdList").empty().append('<option value="">请选择</option>');
                        $.each(result.data.materialQualityList, function (i, v) {
                            $("#matQualityIdList").append('<option value="' + v.mdId + '">' + v.mdName + '</option>');
                        });
                        //必不可少的刷新
                        $("#matQualityIdList").selectpicker('refresh');

                        $("#matSpecIdList").empty().append('<option value="">请选择</option>');
                        $.each(result.data.materialSpecList, function (i, v) {
                            $("#matSpecIdList").append('<option value="' + v.mdId + '">' + v.mdName + '</option>');
                        });
                        //必不可少的刷新
                        $("#matSpecIdList").selectpicker('refresh');
                    }
                }
            });
        });

        /** 表格搜索 */
        $("#btn-search").click(function () {
            js.table.destroy(table);
            openInventoryList();
        });

        /** 清空筛选条件 */
        $("#btn-clear").click(function () {

            js.reset("queryForm");
            $("#materialKind").val('').trigger("change");
        });

    })

</script>


</body>
</html>